package com.bianxianmao.duobao.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.bianxianmao.base.BaseFragment;

import java.util.List;

/**
 * Created by Administrator on 2017/8/1.
 */

public class MyViewPagerAdapter extends FragmentPagerAdapter {
    private String[] strs;
    private List<BaseFragment> fragments;
    private FragmentManager fm;

    public MyViewPagerAdapter(FragmentManager fm, List<BaseFragment> fragments, String[] strs) {
        super(fm);
        this.fragments = fragments;
        this.strs = strs;

    }

    @Override
    public Fragment getItem(int position) {
//        return DuoBaoFactory.createFragment(position, strs[position]);
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return strs != null ? strs.length : 0;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return strs[position];
    }

}
